

function settime(time = +new Date()) {
    // 增加8小时
    var date = new Date(time + 8 * 3600 * 1000);
    return date.toJSON().substr(0, 19).replace('T', ' ');
}
console.log(settime());
// function settime() { //获取当前时间
//     let date = new Date();
//     let seperator1 = "-"; //年月日之间的分隔
//     let seperator2 = ":"; //时分秒之间的分隔
//     let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1; //获取月,如果小于10,前面补个0
//     let strDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); //获取日,如果小于10,前面补个0
//     let strHours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(); //获取小时,如果小于10,前面补个0
//     let strMinutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(); //获取分,如果小于10,前面补个0
//     let strSeconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds(); //获取秒,如果小于10,前面补个0
//     let currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate + " " + strHours + seperator2 + strMinutes + seperator2 + strSeconds; //拼接一下
//     return currentdate; //返回
// }


var crypto = require("crypto"); // 密码加密的处理
var md5 = crypto.createHash("md5")
var pwd = "123456"
var password = md5.update(pwd).digest("hex");
console.log(password);


let arr = ['测试', 'js', 'nodejs']
arr.forEach(i => console.log( typeof i))

var email = "cds980919@outlook.com"
var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/g;//邮箱验证
console.log(reg.test(email));